package com.fzu.orderservice.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fzu.commonutil.entity.OrderForm;
import com.fzu.commonutil.entity.User;
import com.fzu.commonutil.params.DataResult;
import com.fzu.commonutil.util.PageVO;
import com.fzu.orderservice.params.ConfirmParam;
import com.fzu.orderservice.params.EndParam;
import com.fzu.orderservice.params.DemandToOrderParam;
import com.fzu.orderservice.params.HousekeeperToOrderParam;
import com.fzu.orderservice.result.OrderFormResult;

import java.util.concurrent.CompletableFuture;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author zyq
 * @since 2023-03-26
 */
public interface OrderFormService extends IService<OrderForm> {

    /**
     * 获取分页列表
     * @param orderForm
     * @param user
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageVO page(OrderForm orderForm, User user, Integer pageNum, Integer pageSize);

    /**
     * 订单详情
     * @param id
     * @return
     */
    OrderFormResult detail(Integer id);

    /**
     * 从需求匹配列表创建订单
     * @param param
     * @param user
     */
    void demandToOrder(DemandToOrderParam param, User user);

    /**
     * 从家政员大厅创建订单
     * @param param
     * @param user
     */
    void housekeeperToOrder(HousekeeperToOrderParam param, User user);

    /**
     * 订单取消
     * @param id
     */
    void cancel(Integer id);

    /**
     * 家政公司确认订单
     * @param id
     * @param user
     */
    void accept(Integer id, User user);

    /**
     * 用户支付
     * @param id
     * @param user
     */
    void pay(Integer id, User user);

    /**
     * 服务开始
     * @param id
     */
    void start(Integer id, User user);

    /**
     * 用户确认结束并评价
     * @param param
     * @param user
     */
    void end(EndParam param, User user);

    /**
     * 公司确认
     * @param param
     * @param user
     */
    void confirm(ConfirmParam param, User user);

    /**
     * 获取订单统计数据，异步任务1
     * @param companyId
     * @return
     */
    CompletableFuture<DataResult> asyncTask1(Integer companyId);

    /**
     * 异步任务2
     * @param companyId
     * @param roleId
     * @return
     */
    CompletableFuture<DataResult> asyncTask2(Integer companyId, Integer roleId);

}
